﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Messaging;
using System.ServiceModel;

namespace APH.Parl2.SearchIngestionHost
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Initializing search ingestion service...");

            if (MessageQueue.Exists(@".\private$\PublishPersistentSubscriberQueueSearchIngestion") == false)
            {
                MessageQueue.Create(@".\private$\PublishPersistentSubscriberQueueSearchIngestion", true);
            }

            ServiceHost searchIngestionHost = new ServiceHost(typeof(SearchIngestionService));
            searchIngestionHost.Open();

            Console.WriteLine("Search ingestion service online.");
            Console.WriteLine("\nPress escape to exit.\n");

            while (true)
            {
                if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                    break;
            }

            searchIngestionHost.Close();            
        }
    }
}
